翻訳と辞書
Words near each other
・ Jensen P66
・ Jensen Prize
・ Jensen PW
・ Jensen Rampart
・ Jensen Ranch
・ Jensen Ranch (Boulder, Wyoming)
・ Jensen Ranch (Selma, California)
・ Jensen Ridge
・ Jensen S-type
・ Jensen S-V8
・ Jensen Steam Engines
・ Jensen!
・ Jensen's alpha
・ Jensen's Bøfhus
・ Jensen's covering theorem
Jensen's Device
・ Jensen's formula
・ Jensen's inequality
・ Jensen's skate
・ Jensen's theorem
・ Jensen, Queensland
・ Jensen, Utah
・ JENSEN-GROUP
・ Jensen-Healey
・ Jensen-Salsbery Laboratories
・ Jensenia
・ Jensenia spinosa
・ Jensenobotrya
・ Jensens Strip
・ Jensen–Shannon divergence


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

Jensen's Device : ウィキペディア英語版
Jensen's Device
Jensen's Device is a computer programming technique that exploits call by name. It was devised by Danish computer scientist Jørn Jensen, who worked with Peter Naur at Regnecentralen. They worked on the GIER Algol compiler, one of the earliest correct implementations of ALGOL 60.〔(Peter Naur's 2005 Turing Award citation ) mentions his work with Jensen on GIER Algol〕 ALGOL 60 used call by name.
==Description==

Jensen's device exploits call by name and side-effects. Call by name is an argument passing convention that delays the evaluation of an argument until it is actually used in the procedure (a consequence of the copy rule for procedures). Algol introduced call by name.
A classic example of Jensen's device is a procedure that computes the sum of a series, \Sigma_^u a_k:〔, pp 141–142〕

real procedure Sum(k, l, u, ak)
value l, u;
integer k, l, u;
real ak;
comment k and ak are passed by name;
begin
real s;
s := 0;
for k := l step 1 until u do
s := s + ak;
Sum := s
end;
In the procedure, the index variable k and summation term ak are passed by name. Call by name enables the procedure to change the value of the index variable during execution of the for loop. Call by name also causes the ak argument to be reevaluated during each iteration of the loop. Typically, ak will depend upon the changing (side-effected) k.
For example, code to compute the first 100 terms of a real array V.
Jensen's device is general. A double summation can be done as:
Sum(i, l, m, Sum(j, l, n, A()))
The Sum function can be employed for arbitrary functions merely by employing the appropriate expressions. If a sum of integers were desired the expression would be just Sum(i,1,100,i);, if a sum of squares of integers, then Sum(i,1,100,i
*i);
, and so on.〔Sum requires a real argument for the term, so type conversion is assumed.〕 A slight variation would be suitable for initiating a numerical integration of an expression by a method very similar to that of Sum.
The evaluation of ak is implemented with a thunk, which is essentially a subroutine with an environment. The thunk is a closure with no arguments. Each time a procedure needs the value of its formal argument, it simply calls the thunk. The thunk evaluates the actual argument in the scope of the calling code (not the scope of the procedure).
In the absence of this pass-by-name facility, it would be necessary to define functions embodying those expressions to be passed according to the protocols of the computer language, or to create a compendium function along with some arrangement to select the desired expression for each usage.

抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「Jensen's Device」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.